﻿using Models;
using Models.Sys;
using System.Data.Entity;
using Zo.Config;

namespace Logics
{
    public class DataContext: DbContext
    {
        public DataContext()
           : base("name=SqlConnection")
        {
             
        }
        public virtual DbSet<Sys_Admin> Sys_Admin { get; set; }
        public virtual DbSet<Sys_AdminRole> Sys_AdminRole { get; set; }
        public virtual DbSet<Sys_Operation> Sys_Operation { get; set; }
        public virtual DbSet<Sys_Role> Sys_Role { get; set; }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //数据库表前缀
            modelBuilder.Types().Configure(c => c.ToTable(AppConfig.Table_prex+c.ClrType.Name));
        }

    }

}
